@file:Suppress("NonAsciiCharacters")

package com.zxy.supplier_system.server.xinyuan.entity

import jakarta.persistence.*
import org.hibernate.annotations.JdbcTypeCode
import org.hibernate.type.SqlTypes
import org.springframework.data.annotation.CreatedDate
import org.springframework.data.jpa.domain.support.AuditingEntityListener
import java.math.BigDecimal
import java.time.OffsetDateTime
@Table(indexes = [
    Index(name = "idx_payment_date", columnList = "paymentDateTime"),
    Index(name = "idx_phone", columnList = "phoneNumber"),
    Index(name = "idx_name", columnList = "name"),
])
@Entity
@EntityListeners(AuditingEntityListener::class)
class XinyuanOrder {

    @Id
    @GeneratedValue(strategy = GenerationType.IDENTITY)
    var id: Int = 0

    lateinit var name: String

    var idCard: String? = null

    var phoneNumber: String? = null

    /**
     * 支付的金额
     */
    var paymentFee: BigDecimal? = null

    /**
     * 政府补贴
     */
    var governmentSubsidies: BigDecimal? = null

    @ManyToOne
    lateinit var goods: XinyuanGoods

    var paymentDateTime: OffsetDateTime? = null

    @CreatedDate
    lateinit var createdDateTime:OffsetDateTime

    var address: String? = null


    /**
     * 银联号码
     */
    var unionPayOrderNumber: String? = null

    /**
     * 发票号码
     */
    var invoiceNumber: String? = null

    /**
     * 电器送货时间
     */
    var deliveryDateTime: OffsetDateTime? = null

    /**
     * 序列号（SN码）
     *
     * 内外机多个用换行符分隔
     */
    var serialNumber: String? = null


    /**
     * 手机的imei1
     */
    var imei1: String? = null

    /**
     * 手机的imei2
     */
    var imei2: String? = null

    /**
     * 身份证正面
     */
    var idCardFrontPicture: String? = null

    /**
     * 身份证反面
     */
    var idCardBackPicture: String? = null

    /**
     * 产品图片
     */
    @JdbcTypeCode(SqlTypes.JSON)
    var productImagePictures: MutableList<String> = mutableListOf()

    /**
     * 发票
     */
    var invoicePicture: String? = null

    /**
     * 银联发票
     */
    var unionPayInvoicePicture: String? = null

    /**
     * 送货单
     */
    var deliveryNotePicture: String? = null
}

